home *** CD-ROM | disk | FTP | other *** search
- Path: academy.bastad.se!news
- From: mikael@academey.bastad.se (Mikael Bergqvist)
- Newsgroups: comp.lang.c++
- Subject: Template declaration in h file and cpp file
- Date: Tue, 05 Mar 1996 11:53:59 GMT
- Organization: Connection Bastad
- Message-ID: <4hhafd$f8d@academy.bastad.se>
- NNTP-Posting-Host: academy.bastad.se
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: 8bit
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hi!
-
- I┤m having a problem with the following code:
-
- SORT.H:
-
- template <class TArray>
- void QSort(int lo,int hi,TArray *array);
-
- END SORT.H
-
- SORT.CPP
- #include "sort.h"
- template <class TArray>
- void QSort(int lo,int hi,TArray *array)
- {
-
- ..... some code
- }
-
- END SORT.CPP
-
- TEST.CPP
-
- #include "sort.h"
-
- int main(void)
- {
- int array[10]={.........};
- QSort(0,9,array);
- }
-
- END TEST.CPP
-
- The problem is that the linker returns the following error:
- Undefinded symbol QSort(int,int,int far *); in module test.cpp
-
- This problem doesent occur if the main function is in SORT.CPP below
- the QSort function.
-
- HELP!
-
- /Mikael
-
-